home *** CD-ROM | disk | FTP | other *** search
- Path: maverick.tad.eds.com!news-admin@tad.eds.com
- From: Erick Wagner <wagnere@netcom.com>
- Newsgroups: comp.lang.c
- Subject: Re: Source utilities for endian conversion
- Date: 30 Jan 1996 16:42:33 GMT
- Organization: PRC
- Message-ID: <4elhpp$925@maverick.tad.eds.com>
- References: <rt9sph42r1m.fsf@topo.nist.gov>
- NNTP-Posting-Host: 148.94.8.235
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.22 (Windows; I; 16bit)
-
- sullypj@topo.nist.gov (Paul J Sullivan) wrote:
- >I am trying to write a routine (c is not my first language) that will
- >allow me to read a binary data file on various platforms. I have
- >encountered the -endian problem and, thus, was wondering what routines
- >exist to convert between big- and little- formats. Is it possible to
- >do this without the conversion i.e. somehow specify a directive?? Is
- >it in a FAQ?
-
- You probably already thought of it, but just in case... Different
- platforms may have different "boundary alignment" rules. Reading the
- data in as character (byte level alignment) may be needed to prevent
- the target platform from skipping over valid data from the source
- platform. Once you have access to the data, then you can swap bytes
- to get it in the correct format.
-
- Erick
-
-